home *** CD-ROM | disk | FTP | other *** search
- Path: uunet!husc6!bloom-beacon!mit-eddie!uw-beaver!tektronix!tekgen!tekred!games
- From: games@tekred.TEK.COM
- Newsgroups: comp.sources.games
- Subject: v04i042: conquer3 - middle earth multi-player game (V3), Part01/08
- Message-ID: <2651@tekred.TEK.COM>
- Date: 16 Jun 88 21:35:21 GMT
- Sender: billr@tekred.TEK.COM
- Lines: 1804
- Approved: billr@saab.CNA.TEK.COM
-
- Submitted by: ihnp4!homxc!smile
- Comp.sources.games: Volume 4, Issue 42
- Archive-name: conquer3/Part01
-
- [Here's the latest version of Ed Barlow's conquer (conquest)
- game. It has lots of enhancements and bug fixes. I have
- compiled this, so I know all of the requisite files are
- here (unlike last time :-)). -br]
-
- #! /bin/sh
- # This is a shell archive. Remove anything before this line, then unpack
- # it by saving it into a file and typing "sh file". To overwrite existing
- # files, type "sh file -c". You can also feed this as standard input via
- # unshar, or by typing "sh <file", e.g.. If this archive is complete, you
- # will see the following message at the end:
- # "End of archive 1 (of 8)."
- # Contents: README MANIFEST display.c newlogin.c
- # Wrapped by billr@saab on Thu Jun 16 09:39:55 1988
- PATH=/bin:/usr/bin:/usr/ucb ; export PATH
- if test -f README -a "${1}" != "-c" ; then
- echo shar: Will not over-write existing file \"README\"
- else
- echo shar: Extracting \"README\" \(15481 characters\)
- sed "s/^X//" >README <<'END_OF_README'
- X
- X NOTES TO INSTALLER OF CONQUER
- X
- XWhat you have here is a copyrighted release 3 version version of CONQUER.
- XI make no guaranties to the sanity or style of this code, but do believe
- Xthat it should work as documented. I have included numerous bugfixes
- Xfrom previous releases posting, and have added numerous enhancements.
- X
- XMy current email address is {ihnp4}!homxc!smile. I try to answer all
- Xmail, but sometimes it is dificult. All feature requests that are sent
- Xin will be considered, and these are my primary method of deciding what
- Xto add to the code. Your interest is appreciated.
- XNote that I only work on Conquer out of work hours, and so sometimes it
- Xwill take a while to get to it.
- X
- XIncluded in this file are the following:
- X
- X 1) A Brief Description of Conquer
- X 2) Installation (unpacking) Instructions
- X 3) Configuration Instructions
- X 4) Compilation Instructions
- X 5) Administration instructions
- X 6) Changes in this version
- X 7) Problems that I know about are or desired changes
- X
- XThis version should not be redistributed.
- XAny comments and bug reports would be appreciated.
- X
- X-----------------------------------------------------------
- XI A Brief Description of Conquer
- X-----------------------------------------------------------
- X
- XREAD the files "man.page" and "conquer.docs" for a description of
- Xconquer. Conquer.docs is equivalent to the on line help, found in
- Xthe file "help". These two documents are created when the program
- Xis compiled. I have tried to make the documentation as good as possible,
- Xbut I guarantee that I have missed a lot.
- X
- X-----------------------------------------------------------
- XII Installation (unpacking) Instructions
- X-----------------------------------------------------------
- X
- XThis program came in several shar scripts, which can be unpacked
- Xby using "sh filename". If you are reading this, you know this.
- X
- XIf you suspect missing files, please check the MANIFEST.
- X
- X-----------------------------------------------------------
- XIII Configuration
- X-----------------------------------------------------------
- X
- XTHE FOLLOWING FILES SHOULD BE MODIFIED TO REFLECT YOUR ENVIRONMENT
- XAND THE TYPE OF GAME YOU WISH TO PLAY.
- X
- Xheader file: header.h modify as per instructions
- X data.h probably needs no modifications
- Xmakefile: Makefile modify as per instructions
- X
- XI have tried to comment this stuff appropriately.
- X
- XThe options specified in the configuration files will be reflected
- Xin the conquer.docs and help files when the program is compiled.
- X
- X-----------------------------------------------------------
- XIV Compilation Instructions
- X-----------------------------------------------------------
- X
- XBrowse the file header.h. This sets up configurable parameters for the
- Xgame. This program should be easy to compile. Just type make.
- X
- XNote: Sometimes curses does not include termcap or termlib. If all the
- X '.c' files get compiled, but do not compile together, and
- X unreferenced symbol errors occur, try adding "-ltermcap" after
- X the "-lcurses" line in the makefile.
- X
- X-----------------------------------------------------------
- XV administration instructions
- X-----------------------------------------------------------
- X
- XNow that you have compiled it, this is how you administer the game.
- XI recommend following these instructions once yourself in a mock game
- X(ie. no other players) for a few turns to get things straight. Then you
- Xcan add other players.
- X
- XYou can type the following commands to help administer the game
- X
- Xmake: Compiles the code.
- Xmake clobber: Clobber everything but the source (destroys executables)
- Xmake clean: Clean up objects (does not destroy executables)
- Xmake new_game: Create a new game, make world, add players...
- Xmake docs: Creates documentation from help file
- X
- Xrun: read this shell script, it permits you to run the update
- X automatically. It needs to be modified for time to update.
- X
- XThe command line for the two executables created can be found by reading
- Xthe help files. The admin executable is for the game super user only,
- Xand the conquer executable is for the players.
- X
- XAgain, prior to the compile, you should have followed the instructions
- Xin the Makefile and in header.h.
- X
- XYou can administrate world either via "make new_game" or via:
- X <admin -m> this will make your world.
- X This also sets up npc nations as per the nations file
- X npc stats can be adjusted by editing nations
- X prior to making the world. Non player nations have
- X the same password as god.
- X
- XAdd 0 or more players via
- X <admin -a> which should be self explanatory
- X
- X
- XOnce you log in as a player or as god, you can get help by
- Xtyping '?'. Play around with the commands and get your syntax right.
- X
- XTry logging in as either a player or non player nation (they use the super
- Xuser password) and noticing any differences.
- X
- XIMPORTANT FOR PLAY BALANCE:
- XThe world is not created equal. Some players may start in very bad
- Xpositions. You can either start them over (destroy that nation in the
- Xchange nation command and create a new one), or modify the surrounding
- Xterain appropriately (god can use the redesignate command to change
- Xelevation and vegitation).
- XNow move around on the map and learn where the players are
- Xpositioned. If there is a problem (they are surrounded by water...),
- Xuse the redesignate command to change elevation or vegetation.
- XIn the worst case, god can destroy a nation
- Xwith 'c', the change nation command. Once you
- Xthink the game will be fair, it is time to allow players to proceed.
- X
- XNow you are all set -- play via
- X <conquer>
- X
- Xand update with <admin -x> via an script similar to the one contained in "run".
- X
- X-----------------------------------------------------------
- XVI Changes in this version
- X-----------------------------------------------------------
- X
- XThe following changes have been added in this version (v3).
- X
- X1) Peasant revolts should turn 25% of populace into militia.
- X2) nations in revolt have unique names.
- X3) Ships no longer can move overland
- X4) NPCs should only able to get WARRIOR type, MONSTER type, KNOWALL, DERVISH,
- X DESTROYER, HIDDEN, VOID, ARCHITECT, VAMPIRE, HEALER, MINER, BREEDER,
- X URBAN, and STEEL, ARCHER POWERS, SLAVER
- X NPCs now utilize powers. If ARCHER => all non militia units = ARCHER
- X5) Lizard armies are limited in how far they can wander
- X6) Warrior power is now used by NPCs in recruitment
- X7) added getopt.c for ibm pc's /* need to test it */
- X8) Ship costs increased
- X9) tyranny class name changed to warlord
- X10) new random events --
- X volcano strikes country, earthquake, tornado, general prosperity.
- X11) added percentage chance that a volcano will go off somewhere on the globe.
- X12) added lockfile mechanism to prevent players from logging in twice.
- X13) creation of mountains based on map sized /* need to test */
- X14) fixed the mail editor so it processes only
- X printable characters and so vt220 delete key works.
- X15) fort,gold,and iron should be char
- X16) added starting # of people... for enforcement in drafting
- X17) moved startgold and startpeople stuff to execute.c
- X18) Iron for new units several places was not updated.
- X19) now use drand48() on sysV and random() on BSD instead of rand()
- X20) NPCs now have militia in all their cities. NPC militia must not move.
- X21) Help file should give more details on races, diplomacy, army stats.
- X22) passwrod prompt made more explicit
- X23) magic powers now broken up more logically (magic/civilian/military)
- X more powers added. Powers should effect units you can build.
- X added use of powers[i], getnumpowers(type,country),
- X and getmgkcost(type,country)
- X24) added data.c
- X25) added hangup routine... need to test.
- X26) added control L redraw on movement screen... need to test
- X27) Split the game into 2 functioning units: Move Entry and
- X Move Execution. This will help players on pc's.
- X28) prevent countries from taking themselves over
- X29) limited number of mercenaries to 1/2 your regular troops
- X30) Fixed destroyer power... destroyers can redesignatie their sectors.
- X if they lose the sector, it reverts to desert. All sectors in
- X the radius now become desert
- X31) reproduction and production fall off if too many people are in a sector
- X32) make production ability fall off with increasing usage. Each ??? mined
- X gives 100% chance of reducing the iron/jewel value of a sector by one
- X33) ???% chance of a sector gaining 1 point of iron/jewels in a turn.
- X34) Changed the markers so that they are consistent.
- X Upper case - nation marks
- X Lower case - sector designations (rename cities to towns)
- X char *ele= "#^%-~";
- X char *des= "ctmfx$!-";
- X char *veg= "vdyblgwfjsi~";
- X35) Magic screen should permit use of magic spells.
- X36) It should take min(75,tmil/150) to take over sector only for pcs
- X37) Classes: all classes should start with some sort of magic powers.
- X38) new screen option for showing food value.
- X39) joined ninja and spy powers
- X40) reworked npc movement
- X41) Modified the header.h file so that TAXFOOD is only 40, and TAXIRON is 60,
- X TAXJEWELS is 80. This should significantly reduce the amount
- X of gold that nations have to play with.
- X42) Add elephant unit type
- X43) -D game to make smaller executables
- X44) added extended commands
- X45) Added slaver power
- X46) Made buying a city cost a larger amount of money.
- X47) Made spreadsheet() for update,reports,npcs which returns structure of
- X information on production abilities.
- X48) intelligent npc sector redesignation
- X49) have broken down my pceattr, atkattr, and defendattr() routines
- X into components... the building blocks of strategies.
- X These strategies have not been implemented but for example are...
- X
- X peaceful expand, peaceful hold, attack_empty_sectors(country),
- X survival, fortify, build, attack(nation number), jihad(nation number),
- X attack_army(nation), jihad_army(nation), take(race)...,
- X defend(nation), defend_army(nation), etc...
- X
- XThese will be pulled together into a list of "strategies" which will
- Xbe stored in the active variable in the nation strucutre. The higher
- Xthe number, the more likely the nation will be to jihad() against PC's.
- XLow numbered nations will not be likely to instigate a war...
- Xwill need to write an additional diplomacy routine.
- X50) Rewrote Makefile
- X
- X51) "verifying that nation x exists" string changed to "Loading nation x".
- X52) integer and nation name input allows better deletion.
- X53) OGOD option will allow the god to have greater power
- X (remove magic and give magic) as well as tightening security.
- X54) DERVDESG option will change DERVISH (and DESTROYER) power
- X so that they will be able to redesignate sectors instead of
- X the previous automatic food generation. (may have desert mines,
- X towns, etc...)
- X55) rewrote tofood so that it was passed the country
- X number as well as a vegetation. (this means that display food
- X will show 6 for deserts with DERVISH power)
- X56) HIDELOC option will make it so that the news will not print
- X the sector locations for battles and randomevents. (had to create
- X a disaster report that is mailed to PC players so that they can
- X know where a tornado or earthquake etc... struck.)
- X57) saw what you did with newhelp.c and build it up so fixed it
- X so that it would work to create a new help file. NOTE: make sure
- X that the help file is moved to help.txt after being patched.
- X Look at the makefile to see what I mean.
- X58) altered randevent.c so that it would select a city/mine/goldmine
- X at random, not starting from the upperleft.
- X59) altered display in BUDGET and PRODUCTION so that it will not be
- X ruined with nations started getting 500000 or more people.
- X60) prettified all of the things that seemed a little off.
- X61) did stuff to newlogin to make it beautiful
- X62) Miscelaneous V2.2 fixes.
- X Fixed bug that generated too many nomads... now new
- X nomads are based on a nations military might
- X Stopped Mercenary troops from depleting population
- X Fixed News section bug that lists "Country A and B declare ceasefire"
- X followed by "Country B declares war on A"
- X Lowered town cost to 100000.
- X63)
- XShould force defeated armies to retreat if battle lost and not city
- X-----------------------------------------------------------
- XVII Problems that I know about are or desired changes
- X-----------------------------------------------------------
- X
- Xplatinum to add add to spell points at 25K per point.
- XSector ownership rules must change - capture on 8:1 odds always.
- XShould have SEIGE and SEIGED status for armies
- X
- XChange movement so that when you move into a sector you don't own (that is also
- Xnot owned bya friend or ally) you either stop automatically or at least use
- Xmore movement, say twice normal to scout it out.
- X
- Xnew powers :
- X TRADER : Generally has very good diplomacy status, half cost to
- X construct and maintain merchant ships
- X
- Xallow nations to redesignate a sector to devastated if they
- X wish, which discourages their populace from inhabiting it.
- X
- Xkeep track of the date... I should use a variable in nation 0
- X (how about its location variable...).
- X
- Xmake newlogin give nations added after the starting date extra points
- Xbased on the scores of the PC nations playing. This is not for
- Xrebel nations.
- X
- Xchange readnews, fleetrpt, and armyrpt slightly so they only redraw the
- X screen if you have something to look at.
- X
- XMake the update keep track of which PC's didn't move and at the end of the
- Xupdate it puts a copy of the news for that turn into their message files.
- XMake the update keep a copy of the newsfile in a turn log as well, which
- Xwill keep news files from all turns in a game, and in the future I will
- Ximplement a command that allows you to look up the log for a particular turn
- Xfrom within the program, in place of the news command.
- X
- Xadded to randevents so it prints a message of what happened to the nation
- X it affected. This probably isn't really necessary now since players
- X that miss turns will have the news saved, but I did it before I
- X implemented the news saving. I do need to add several message
- X printings to the new/newly implemented randevents, though.
- X
- Xrebel nations should have unique names - from table & unique nation marks
- XShould have ubiquitous castle designation.
- X
- XShips will now have 50 man crews - which can melee and fight.
- X Troops are required on ships.
- X Each fleet may carry one army of Marines (in addition to any troops
- X that are ferried - who dont count in combat). Marines add to chances
- X of success in shipboard combat.
- X
- XSea combat - 3 rounds
- X get nwarships nmerchants
- X get nmarines/shp nsailors/shp
- X each warship ship ram 20% (+10% if SAILOR) - will sink
- X Boarding
- X get nsolds (nships*sold/ship) and bonus (weighted average)
- X use normal combat
- X casualties are applied to ships!!! only -> 30% chance
- X of collecting prize from boarding
- XFortifications should be demolished in combats by catapults or siege engines.
- X
- XI have written a
- Xlittle trading system, and will send it to you, but I need just one
- Xthing: a command in the execute file that does *increment* of
- Xgold, jewels, iron and food, rather than adjusting the absolute value.
- XCould you add that for me quickly? I really think it would
- Xbe worth it.
- X
- XThere is a problem with the logic of sector taking. I have
- Xhad three sectors taken w/out battle from underneath my soldiers. The armies
- Xwere never more than three times greater (and that is pushing). Plus, one of
- Xthem, the latest, took my sector with exactly 112 soldiers to my 80 (I now
- Xhave the ninja power, so I know for sure). The sector is taken, but NOT listed
- Xas taken in the NEWS. (The people are killed and the sector devastated,
- Xhowever)
- END_OF_README
- if test 15481 -ne `wc -c <README`; then
- echo shar: \"README\" unpacked with wrong size!
- fi
- # end of overwriting check
- fi
- if test -f MANIFEST -a "${1}" != "-c" ; then
- echo shar: Will not over-write existing file \"MANIFEST\"
- else
- echo shar: Extracting \"MANIFEST\" \(1074 characters\)
- sed "s/^X//" >MANIFEST <<'END_OF_MANIFEST'
- X File Name Archive # Description
- X-----------------------------------------------------------
- X FILESIZES 3
- X MANIFEST 1 This shipping list
- X Makefile 4
- X README 1
- X admin.c 8
- X cexecute.c 8
- X combat.c 2
- X commands.c 4
- X data.c 8
- X data.h 6
- X display.c 1
- X extcmds.c 8
- X forms.c 7
- X getopt.c 7
- X header.h 7
- X help.txt 3
- X io.c 5
- X magic.c 6
- X main.c 6
- X makeworld.c 4
- X man.page 8
- X misc.c 3
- X move.c 7
- X nations 5
- X newhelp.c 8
- X newlogin.c 1
- X newlogin.h 8
- X npc.c 2
- X randevent.c 5
- X reports.c 7
- X run 8
- X update.c 5
- END_OF_MANIFEST
- if test 1074 -ne `wc -c <MANIFEST`; then
- echo shar: \"MANIFEST\" unpacked with wrong size!
- fi
- # end of overwriting check
- fi
- if test -f display.c -a "${1}" != "-c" ; then
- echo shar: Will not over-write existing file \"display.c\"
- else
- echo shar: Extracting \"display.c\" \(9939 characters\)
- sed "s/^X//" >display.c <<'END_OF_display.c'
- X/*Print and io subroutines for interactive game*/
- X
- X/*conquer : Copyright (c) 1988 by Ed Barlow.
- X * I spent a long time writing this code & I hope that you respect this.
- X * I give permission to alter the code, but not to copy or redistribute
- X * it without my explicit permission. If you alter the code,
- X * please document changes and send me a copy, so all can have it.
- X * This code, to the best of my knowledge works well, but it is my first
- X * 'C' program and should be treated as such. I disclaim any
- X * responsibility for the codes actions (use at your own risk). I guess
- X * I am saying "Happy gaming", and am trying not to get sued in the process.
- X * Ed
- X */
- X
- X/*include files*/
- X#include <ctype.h>
- X#include "header.h"
- X#include "data.h"
- X
- X/*Declarations*/
- Xextern struct s_sector sct[MAPX][MAPY];
- Xextern struct nation ntn[NTOTAL]; /* player nation stats */
- X
- X/*offset of upper left hand corner*/
- Xextern short xoffset;
- Xextern short yoffset;
- X/*current cursor postion (relative to 00 in upper corner)*/
- X/* position is 2*x,y*/
- Xextern short xcurs;
- Xextern short ycurs;
- X/*redraw map in this turn if redraw is a 1*/
- Xextern short redraw;
- X/*display state SEE data.h FOR CURRENT VALUES OF THESE */
- Xextern short hilmode;
- Xextern short dismode;
- X/* nation id of owner*/
- Xextern short country;
- X
- X/*make a map*/
- Xvoid
- Xmakemap()
- X{
- X register int x,y;
- X register int i,j;
- X short armynum,nvynum;
- X
- X /*can you see all?*/
- X if((magic(country,KNOWALL)==1)||(country==0)) {
- X for(x=0;x<SCREEN_X_SIZE;x++) {
- X for(y=0;y<(LINES-4);y++) {
- X highlight(x,y);
- X see(x,y);
- X }
- X }
- X if((hilmode==HI_ARMY)||(hilmode==HI_MOVE)||(hilmode==HI_YARM)) {
- X for(armynum=0;armynum<MAXARM;armynum++)
- X if((ASOLD>0)&&((AMOVE>0)||(hilmode!=4))){
- X standout();
- X see(AXLOC-xoffset,AYLOC-yoffset);
- X }
- X }
- X }
- X /*see as appropriate?*/
- X else {
- X for(x=0;x<SCREEN_X_SIZE;x++) for(y=0;y<(LINES-4);y++) {
- X if(sct[x+xoffset][y+yoffset].owner==country){
- X for(i=x-LANDSEE;i<=x+LANDSEE;i++){
- X for(j=y-LANDSEE;j<=y+LANDSEE;j++) {
- X highlight(i,j);
- X see(i,j);
- X }
- X }
- X }
- X }
- X for(nvynum=0;nvynum<MAXNAVY;nvynum++) if(NMER+NWAR>0){
- X for(i=NXLOC-xoffset-NAVYSEE;i<=NXLOC-xoffset+NAVYSEE;i++) for(j=NYLOC-yoffset-NAVYSEE;j<=NYLOC-yoffset+NAVYSEE;j++){
- X highlight(i,j);
- X see(i,j);
- X }
- X }
- X for(armynum=0;armynum<MAXARM;armynum++) if(ASOLD>0){
- X for(i=AXLOC-xoffset-ARMYSEE;i<=AXLOC-xoffset+ARMYSEE;i++) for(j=AYLOC-yoffset-ARMYSEE;j<=AYLOC-yoffset+ARMYSEE;j++) {
- X highlight(i,j);
- X see(i,j);
- X }
- X }
- X /*optimal method of highlighting your armies*/
- X if((hilmode==HI_YARM)||(hilmode==HI_MOVE)) {
- X for(armynum=0;armynum<MAXARM;armynum++)
- X if((ASOLD>0)&&((AMOVE>0)||(hilmode==HI_YARM))){
- X standout();
- X see(AXLOC-xoffset,AYLOC-yoffset);
- X }
- X for(nvynum=0;nvynum<MAXNAVY;nvynum++)
- X if((NWAR+NMER>0)&&((NMOVE>0)||(hilmode==HI_YARM))){
- X standout();
- X see(NXLOC-xoffset,NYLOC-yoffset);
- X }
- X }
- X }
- X move(ycurs,2*xcurs);
- X}
- X
- Xvoid
- Xnewdisplay()
- X{
- X mvaddstr(LINES-4,0,"viewing options: (d)esignation, (r)ace, (m)ove cost, (p)eople, (D)efense");
- X clrtoeol();
- X mvaddstr(LINES-3,0," (f)ood, (c)ontour, (v)egetation, (i)ron, (n)ation mark, (j)ewels");
- X clrtoeol();
- X mvaddstr(LINES-2,0,"highlight option: (o)wners, (a)rmy, (y)our Army, (M)ove left, (x)=none");
- X clrtoeol();
- X standout();
- X mvaddstr(LINES-1,0,"what display?:");
- X clrtoeol();
- X move(LINES-1,16);
- X standend();
- X refresh();
- X redraw=TRUE;
- X switch(getch()) {
- X case 'f':
- X dismode=DI_FOOD;
- X break;
- X case 'v': /* vegetation map*/
- X dismode=DI_VEGE;
- X break;
- X case 'd': /* designations map*/
- X dismode=DI_DESI;
- X break;
- X case 'c': /* contour map of world */
- X dismode=DI_CONT;
- X break;
- X case 'n': /* nations map*/
- X dismode=DI_NATI;
- X break;
- X case 'r': /* race map*/
- X dismode=DI_RACE;
- X break;
- X case 'm': /* move cost map*/
- X dismode=DI_MOVE;
- X break;
- X case 'D':
- X dismode=DI_DEFE;
- X break;
- X case 'p':
- X dismode=DI_PEOP;
- X break;
- X case 'j':
- X dismode=DI_GOLD;
- X break;
- X case 'i':
- X dismode=DI_IRON;
- X break;
- X case 'a': /* armies hilighted map*/
- X prep(country);
- X hilmode=HI_ARMY;
- X break;
- X case 'o': /* owners hilighted map*/
- X hilmode=HI_OWN;
- X break;
- X case 'x': /*no highlighting*/
- X hilmode=HI_NONE;
- X break;
- X case 'y': /* your armies hilighted map*/
- X prep(country);
- X hilmode=HI_YARM;
- X break;
- X case 'M': /* your armies with moves left hilighted map*/
- X prep(country);
- X hilmode=HI_MOVE;
- X break;
- X default:
- X beep();
- X redraw=FALSE;
- X }
- X makebottom();
- X}
- X
- X/*see what is in xy as per display mode*/
- Xvoid
- Xsee(x,y)
- X{
- X int armbonus;
- X if((x<0)||(y<0)||(x>COLS-21)||(y>=LINES-4)) return;
- X if(((y+yoffset)<MAPY)&&((x+xoffset)<MAPX)) {
- X
- X if((magic(sct[x+xoffset][y+yoffset].owner,THE_VOID)==TRUE)
- X &&((dismode==DI_DEFE)||(dismode==DI_GOLD)||(dismode==DI_IRON)
- X ||(dismode==DI_PEOP)||(dismode==DI_FOOD))
- X &&(country!=sct[x+xoffset][y+yoffset].owner)
- X &&(country!=0)) {
- X standout();
- X mvaddch(y,2*x,' ');
- X standend();
- X } else {
- X switch(dismode){
- X case DI_FOOD: /*food */
- X if(tofood(sct[x+xoffset][y+yoffset].vegetation,country)==0)
- X mvaddch(y,2*x,sct[x+xoffset][y+yoffset].vegetation);
- X else
- X mvprintw(y,2*x,"%d",tofood(sct[x+xoffset][y+yoffset].vegetation,country));
- X break;
- X case DI_VEGE: /*vegetation*/
- X mvaddch(y,2*x,sct[x+xoffset][y+yoffset].vegetation);
- X break;
- X case DI_DESI: /*designation*/
- X if(sct[x+xoffset][y+yoffset].owner==0){
- X if(tofood(sct[x+xoffset][y+yoffset].vegetation,sct[x+xoffset][y+yoffset].owner)!=0) mvaddch(y,2*x,sct[x+xoffset][y+yoffset].altitude);
- X else mvaddch(y,2*x,sct[x+xoffset][y+yoffset].vegetation);
- X }
- X else if((country==0)
- X ||(sct[x+xoffset][y+yoffset].owner==country))
- X mvaddch(y,2*x,sct[x+xoffset][y+yoffset].designation);
- X else mvaddch(y,2*x,ntn[sct[x+xoffset][y+yoffset].owner].mark);
- X break;
- X case DI_CONT: /*contour*/
- X mvaddch(y,2*x,sct[x+xoffset][y+yoffset].altitude);
- X break;
- X case DI_NATI: /*ownership*/
- X if(sct[x+xoffset][y+yoffset].owner==0)
- X mvaddch(y,2*x,sct[x+xoffset][y+yoffset].altitude);
- X else mvaddch(y,2*x,ntn[sct[x+xoffset][y+yoffset].owner].mark);
- X break;
- X case DI_RACE: /*race*/
- X if(sct[x+xoffset][y+yoffset].owner==0)
- X mvaddch(y,2*x,sct[x+xoffset][y+yoffset].altitude);
- X else mvaddch(y,2*x,ntn[sct[x+xoffset][y+yoffset].owner].race);
- X break;
- X case DI_MOVE: /*movement cost map*/
- X if(movecost[x+xoffset][y+yoffset]>=0) mvprintw(y,2*x,"%d",movecost[x+xoffset][y+yoffset]);
- X else if(sct[x+xoffset][y+yoffset].altitude==WATER)
- X mvaddch(y,2*x,WATER);
- X else
- X mvaddch(y,2*x,'X');
- X break;
- X case DI_DEFE: /*Defence*/
- X if (sct[x+xoffset][y+yoffset].altitude==WATER)
- X mvaddch(y,2*x,WATER);
- X else if (movecost[x+xoffset][y+yoffset]<0)
- X mvaddch(y,2*x,'*');
- X else {
- X
- X /*Racial combat bonus due to terrain (the faster you move the better)*/
- X armbonus=0;
- X armbonus+=5*(9-movecost[x+xoffset][y+yoffset]);
- X
- X if(sct[x+xoffset][y+yoffset].altitude==MOUNTAIN) armbonus+=40;
- X else if(sct[x+xoffset][y+yoffset].altitude==HILL) armbonus+=20;
- X
- X if(sct[x+xoffset][y+yoffset].vegetation==JUNGLE)
- X armbonus+=30;
- X else if(sct[x+xoffset][y+yoffset].vegetation==FOREST)
- X armbonus+=20;
- X else if(sct[x+xoffset][y+yoffset].vegetation==WOOD)
- X armbonus+=10;
- X
- X if((sct[x+xoffset][y+yoffset].designation==DCASTLE)
- X ||(sct[x+xoffset][y+yoffset].designation==DCITY)
- X ||(sct[x+xoffset][y+yoffset].designation==DCAPITOL))
- X armbonus+=8*sct[x+xoffset][y+yoffset].fortress;
- X
- X mvprintw(y,2*x,"%d",armbonus/20);
- X }
- X break;
- X case DI_PEOP: /*People*/
- X if (sct[x+xoffset][y+yoffset].altitude==WATER)
- X mvaddch(y,2*x,WATER);
- X else if (sct[x+xoffset][y+yoffset].people>=1000)
- X mvaddch(y,2*x,'+');
- X else if (sct[x+xoffset][y+yoffset].people>=450)
- X mvaddch(y,2*x,'>');
- X else if (sct[x+xoffset][y+yoffset].people==0)
- X mvaddch(y,2*x,'0');
- X else
- X mvprintw(y,2*x,"%d",1+sct[x+xoffset][y+yoffset].people/50);
- X break;
- X case DI_GOLD: /*Gold*/
- X if (sct[x+xoffset][y+yoffset].altitude==WATER)
- X mvaddch(y,2*x,WATER);
- X else if(tofood(sct[x+xoffset][y+yoffset].vegetation,country)==0)
- X mvaddch(y,2*x,'X');
- X else if((sct[x+xoffset][y+yoffset].owner!=0)
- X &&(country!=0)
- X &&(sct[x+xoffset][y+yoffset].owner!=country))
- X mvaddch(y,2*x,'?');
- X else if(sct[x+xoffset][y+yoffset].gold>=10)
- X mvaddch(y,2*x,'+');
- X else
- X mvprintw(y,2*x,"%d",sct[x+xoffset][y+yoffset].gold);
- X break;
- X case DI_IRON: /*Iron*/
- X if (sct[x+xoffset][y+yoffset].altitude==WATER)
- X mvaddch(y,2*x,WATER);
- X else if(tofood(sct[x+xoffset][y+yoffset].vegetation,country)==0)
- X mvaddch(y,2*x,'X');
- X else if((sct[x+xoffset][y+yoffset].owner!=0)
- X &&(country!=0)
- X &&(sct[x+xoffset][y+yoffset].owner!=country))
- X mvaddch(y,2*x,'?');
- X else if (sct[x+xoffset][y+yoffset].iron>=10)
- X mvaddch(y,2*x,'+');
- X else
- X mvprintw(y,2*x,"%d",sct[x+xoffset][y+yoffset].iron);
- X break;
- X default:
- X break;
- X }
- X }
- X }
- X else mvaddch(y,2*x,' ');
- X standend();
- X}
- X
- X/*highlight what is in xy as per highlight mode*/
- Xvoid
- Xhighlight(x,y)
- X{
- X if((x<0)||(y<0)||(x>COLS-21)||(y>=LINES-4)) return;
- X if(((y+yoffset)<MAPY)&&((x+xoffset)<MAPX)) {
- X switch(hilmode){
- X case HI_OWN: /*ownership*/
- X if(country==0) {
- X if(sct[x+xoffset][y+yoffset].owner>0)
- X standout();
- X }
- X else if(sct[x+xoffset][y+yoffset].owner==country)
- X standout();
- X break;
- X case HI_ARMY: /*army map*/
- X if(occ[x+xoffset][y+yoffset]!=0) standout();
- X break;
- X default:
- X break;
- X }
- X }
- X}
- X
- X/* check if cursor is out of bounds*/
- Xvoid
- Xcoffmap()
- X{
- X if((xcurs<1)||(ycurs<1)||(xcurs>=SCREEN_X_SIZE)
- X ||((ycurs>=SCREEN_Y_SIZE))||((XREAL)>=MAPX)
- X ||((YREAL)>=MAPY)) offmap();
- X
- X /*update map*/
- X if(redraw==TRUE) {
- X clear();
- X makemap(); /* update map*/
- X makebottom();
- X redraw=FALSE;
- X }
- X move(ycurs,2*xcurs);
- X makeside(); /*update side*/
- X move(ycurs,2*xcurs);
- X refresh();
- X}
- END_OF_display.c
- if test 9939 -ne `wc -c <display.c`; then
- echo shar: \"display.c\" unpacked with wrong size!
- fi
- # end of overwriting check
- fi
- if test -f newlogin.c -a "${1}" != "-c" ; then
- echo shar: Will not over-write existing file \"newlogin.c\"
- else
- echo shar: Extracting \"newlogin.c\" \(28406 characters\)
- sed "s/^X//" >newlogin.c <<'END_OF_newlogin.c'
- X/*conquer : Copyright (c) 1988 by Ed Barlow.
- X * I spent a long time writing this code & I hope that you respect this.
- X * I give permission to alter the code, but not to copy or redistribute
- X * it without my explicit permission. If you alter the code,
- X * please document changes and send me a copy, so all can have it.
- X * This code, to the best of my knowledge works well, but it is my first
- X * 'C' program and should be treated as such. I disclaim any
- X * responsibility for the codes actions (use at your own risk). I guess
- X * I am saying "Happy gaming", and am trying not to get sued in the process.
- X * Ed
- X */
- X
- X/*create a new login for a new player*/
- X#include <ctype.h>
- X#include "newlogin.h"
- X#include "header.h"
- X#include "data.h"
- X
- Xextern FILE *fexe, *fopen();
- Xextern short country;
- X
- Xvoid
- Xnewlogin()
- X{
- X /* use points to create empire, add if late starter*/
- X int points;
- X char tempc[10];
- X int n;
- X int valid=TRUE; /*valid==FALSE means continue loop*/
- X int temp;
- X int more=TRUE; /*0 if add another player*/
- X int loop;
- X long x;
- X char tempo[8];
- X char passwd[8];
- X register i;
- X
- X printf("\nPreparing to add player\n");
- X printf("break at any time to abort\n");
- X
- X while(more==TRUE) {
- X points=MAXPTS;
- X /*find valid nation number type*/
- X for(i=1;i<MAXNTN;i++)
- X if(ntn[i].active==0) {
- X country=i;
- X break;
- X }
- X printf("first valid nation id is %d\n",country);
- X
- X if(i==MAXNTN) {
- X beep();
- X printf("error, cant add new nation\n");
- X return;
- X }
- X
- X /* open output for future printing*/
- X sprintf(tempc,"%s%d",exefile,i);
- X if ((fexe=fopen(tempc,"w"))==NULL) {
- X beep();
- X printf("error opening %s\n",tempc);
- X exit(FAIL);
- X }
- X
- X ntn[country].active=1;
- X
- X valid=FALSE;
- X /*get name*/
- X while(valid==FALSE) {
- X valid=TRUE;
- X printf("\nwhat name would you like your nation to have:");
- X scanf("%s",ntn[country].name);
- X
- X if((strlen(ntn[country].name)<=1)
- X ||(strlen(ntn[country].name)>NAMELTH)){
- X printf("\ninvalid name");
- X valid=FALSE;
- X }
- X
- X /*check if already used*/
- X if((strcmp(ntn[country].name,"god")==0)
- X ||(strcmp(ntn[country].name,"unowned")==0)){
- X printf("\nname already used");
- X valid=FALSE;
- X }
- X
- X for(i=1;i<MAXNTN;i++)
- X if((i!=country)&&(strcmp(ntn[i].name,ntn[country].name)==0)) {
- X printf("\nname already used");
- X valid=FALSE;
- X }
- X }
- X
- X /*get password*/
- X valid=FALSE;
- X while(valid==FALSE) {
- X printf("\nwhat is your nations password:");
- X scanf("%7s",passwd);
- X if((strlen(passwd)>PASSLTH)||(strlen(passwd)<2)) {
- X beep();
- X printf("\ninvalid password (too short or long)");
- X }
- X else {
- X printf("\nreenter your nations password:");
- X scanf("%7s",ntn[country].passwd);
- X }
- X if(strcmp(passwd,ntn[country].passwd)==0) valid=TRUE;
- X }
- X strncpy(ntn[country].passwd,crypt(passwd,SALT),PASSLTH);
- X
- X /*get your name*/
- X valid=FALSE;
- X while(valid==FALSE) {
- X valid=TRUE;
- X printf("\nenter either YOUR name (j_smith) or the name of your nations leader (gandalf...)");
- X printf("\n\t(maximum 10 characters, no spaces):");
- X scanf("%s",tempc);
- X if((strlen(tempc)>=10)||(strlen(tempc)<2)) {
- X beep();
- X printf("\ninvalid name (too short or long)");
- X valid=FALSE;
- X }
- X else strcpy(ntn[country].leader,tempc);
- X }
- X
- X valid=FALSE;
- X while(valid==FALSE) {
- X valid=TRUE;
- X printf("\nwhat race would you like to be:");
- X printf("\n\tchoose (d)warf,(e)lf,(o)rc,(h)uman:");
- X scanf("%1s",tempo);
- X switch(tempo[0]) {
- X case 'd':
- X printf("\ndwarf chosen\n");
- X /*MINER POWER INATE TO DWARVES*/
- X printf("you have magical MINING skills\n");
- X ntn[country].powers=MINER;
- X x=MINER;
- X CHGMGK;
- X points -= getclass(DWARF);
- X ntn[country].race=DWARF;
- X ntn[country].tgold=NLDGOLD; /*1 pts*/
- X ntn[country].tfood=NLDFOOD; /*0 pts*/
- X ntn[country].jewels=NLDJEWEL; /*0 pts*/
- X ntn[country].tiron=NLDIRON; /*0 pts*/
- X ntn[country].tciv= NLDCIVIL; /*6 pts*/
- X ntn[country].tmil= NLDMILIT; /*1.5 pts*/
- X ntn[country].repro= NLDREPRO; /*4 pts*/
- X ntn[country].maxmove= NLDMMOVE; /*1.5 pts*/
- X ntn[country].aplus= NLDAPLUS; /*2 pts*/
- X ntn[country].dplus= NLDDPLUS; /*2 pts*/
- X ntn[country].location=RANDOM; /*0+ pts*/
- X points-=NLPTDW;
- X break;
- X case 'e':
- X printf("\nelf chosen\n");
- X printf("you have magical cloaking skills\n");
- X ntn[country].powers=THE_VOID;
- X x=THE_VOID;
- X CHGMGK;
- X points -= getclass(ELF);
- X ntn[country].race=ELF;
- X ntn[country].tgold=NLEGOLD; /*1 pts*/
- X ntn[country].tfood=NLEFOOD;
- X ntn[country].jewels=NLEJEWEL;
- X ntn[country].tiron=NLEIRON;
- X ntn[country].tciv=NLECIVIL; /*7 pts*/
- X ntn[country].tmil=NLEMILIT; /*0 pts*/
- X ntn[country].repro=NLEREPRO; /*3 pts*/
- X ntn[country].maxmove=NLEMMOVE; /*2 pts*/
- X ntn[country].aplus=NLEAPLUS; /*1 pts*/
- X ntn[country].dplus=NLEDPLUS; /*4 pts*/
- X ntn[country].location=FAIR; /*1 pts*/
- X points-=NLPTEL; /* VOID COSTS ADDITIONAL PT*/
- X break;
- X case 'o':
- X printf("\norc chosen\n");
- X /*MINOR MONSTER POWER INATE TO ORCS*/
- X printf("your leader is a minor monster (army 0 is very potent)\n");
- X ntn[country].powers=MI_MONST;
- X x=MI_MONST;
- X CHGMGK;
- X points -= getclass(ORC);
- X ntn[country].race=ORC;
- X ntn[country].tgold=NLOGOLD; /*0 pts*/
- X ntn[country].tfood=NLOFOOD;
- X ntn[country].jewels=NLOJEWEL;
- X ntn[country].tiron=NLOIRON;
- X ntn[country].tciv=NLOCIVIL; /*4 pts*/
- X ntn[country].tmil=NLOMILIT; /*2.5 pts*/
- X ntn[country].repro=NLOREPRO; /*10 pts*/
- X ntn[country].maxmove=NLOMMOVE; /*1.5 pts*/
- X ntn[country].aplus=NLOAPLUS; /*0 pts*/
- X ntn[country].dplus=NLODPLUS; /*0 pts*/
- X ntn[country].location=RANDOM; /*0 pts*/
- X points-=NLPTOR;
- X break;
- X case 'h':
- X printf("\nhuman chosen\n");
- X ntn[country].race=HUMAN;
- X /*WARRIOR POWER INATE TO HUMANS*/
- X printf("you have magical WARRIOR skills\n");
- X ntn[country].powers=WARRIOR;
- X x=WARRIOR;
- X CHGMGK;
- X points -= getclass(HUMAN);
- X ntn[country].tgold=NLHGOLD; /*0 pts*/
- X ntn[country].tfood=NLHFOOD; /*0 pts*/
- X ntn[country].jewels=NLHJEWEL; /*0 pts*/
- X ntn[country].tiron=NLHIRON; /*0 pts*/
- X ntn[country].tciv=NLHCIVIL; /*6 pts*/
- X ntn[country].tmil=NLHMILIT; /*1 pts*/
- X ntn[country].repro=NLHREPRO; /*5 pts*/
- X ntn[country].maxmove=NLHMMOVE; /*2.5 pts*/
- X ntn[country].aplus=NLHAPLUS; /*1 pts*/
- X ntn[country].dplus=NLHDPLUS; /*1 pts*/
- X ntn[country].location=RANDOM; /*0 pts*/
- X points-=NLPTHU;
- X break;
- X default:
- X printf("\ninvalid race\n ");
- X valid=0;
- X }
- X }
- X
- X ntn[country].mark = toupper(*ntn[country].name);
- X printf("\ntesting first letter of name (%c) for nation mark...",ntn[country].mark);
- X valid=TRUE;
- X while(valid==TRUE) {
- X valid=FALSE;
- X if((isprint(ntn[country].mark)==0)
- X ||(isspace(ntn[country].mark)!=0)) {
- X printf("\n%c is not a graphical character",ntn[country].mark);
- X valid=TRUE;
- X }
- X if(valid==FALSE) for(i=0;i<=3;i++)
- X if(ntn[country].mark==(*(ele+i))) {
- X printf("\n%c is an altitude character",ntn[country].mark);
- X valid=TRUE;
- X }
- X if(valid==FALSE) for(i=0;i<=11;i++)
- X if(ntn[country].mark==(*(veg+i))) {
- X printf("\n%c is a vegetation character", ntn[country].mark );
- X valid=TRUE;
- X }
- X if(valid==FALSE) for(i=1;i<country;i++)
- X if(ntn[i].mark==ntn[country].mark) {
- X printf("\n%c is an already used character",ntn[country].mark);
- X valid=TRUE;
- X }
- X if(valid==FALSE) if(ntn[country].mark=='*') {
- X printf("\n'*' is invalid character");
- X valid=TRUE;
- X }
- X if(valid==TRUE){
- X printf("\nplease reenter new national mark for maps:");
- X printf("\n (this can be any uppercase character)");
- X scanf("%1s",tempc);
- X ntn[country].mark=(*tempc);
- X /* if lower case letter, make it upper */
- X if( islower(ntn[country].mark)!=0)
- X ntn[country].mark=
- X toupper(ntn[country].mark);
- X }
- X else printf("\nvalid...");
- X }
- X
- X printf("mark currently is %c\n",ntn[country].mark);
- X
- X while(points>0) {
- X printf("\n\nwhat would you like to buy with your remaining %d points\n\n",points);
- X printf("\t1. population (%d/pt):\t\tnow have %ld civilians\n",NLPOP,ntn[country].tciv);
- X printf("\t2. more gold ($%d/pt):\t\tnow have %ld gold pieces\n",NLGOLD,ntn[country].tgold);
- X printf("\t3. better location (%d pt):\t\tlocation is now is %c\n",NLLOCCOST,ntn[country].location);
- X printf("\t4. more soldiers (%d/pt):\t\tnow have %ld soldiers\n",NLSOLD,ntn[country].tmil);
- X printf("\t5. better attack (%d%%/pt):\t\tnow is +%d\n ",NLATTACK,ntn[country].aplus);
- X printf("\t6. better defence (%d%%/pt):\t\tnow is +%d\n",NLDEFENCE,ntn[country].dplus);
- X printf("\t7. higher reproduction (+%d%%/%d pt):\trate is now %d%%\n",NLREPRO,NLREPCOST,ntn[country].repro);
- X printf("\t8. higher movement (%d/pt): \t\tnow move %d sectors\n",NLMOVE,ntn[country].maxmove);
- X printf("\t9. double raw recourses (%d pts): \tfood now %ld\n",NLDBLCOST*ntn[country].tfood/NLHFOOD,ntn[country].tfood);
- X printf("\t \tjewels now %ld\n",ntn[country].jewels);
- X printf("\t \tiron now %ld\n",ntn[country].tiron);
- X printf("\t10. additional random magic power (%d pts)\n",NLMAGIC);
- X
- X
- X printf("\nWhat option to buy:");
- X if(scanf("%d",&n)==1) switch(n) {
- X
- X case 1:
- X printf("additional population costs 1 pt per %d\n",NLPOP);
- X printf("how many points to spend on population:");
- X scanf("%d",&temp);
- X putchar('\n');
- X if(points >= temp) {
- X points -= temp;
- X ntn[country].tciv+=temp*NLPOP;
- X }
- X else printf("You dont have enough points left");
- X break;
- X case 2:
- X printf("you now have $%ld\n",ntn[country].tgold);
- X printf("and can buy gold at $%d per point\n",NLGOLD);
- X printf("how many points to spend on added gold:");
- X scanf("%d",&temp);
- X putchar('\n');
- X if(points>=temp)
- X {
- X points-=temp;
- X ntn[country].tgold+=temp*NLGOLD;
- X }
- X else printf("You dont have enough points left");
- X break;
- X case 3:
- X printf("you now are in %c location\n",ntn[country].location);
- X printf(" R=random, F=fair, G=good\n");
- X if(ntn[country].location==RANDOM){
- X printf("%dpts for (g)ood location or 1pts for (f)air\n",2*NLLOCCOST);
- X }
- X if(ntn[country].location==FAIR){
- X printf("%dpts for (g)ood location\n",NLLOCCOST);
- X }
- X if(ntn[country].location==GREAT) return;
- X
- X printf("what type of location do you wish:");
- X scanf("%1s",tempo);
- X switch(tempo[0]) {
- X case 'g':
- X case GREAT:
- X if(ntn[country].location==FAIR){
- X printf("%dpts for (g)ood location\n",NLLOCCOST);
- X if(points>=NLLOCCOST) {
- X points -=NLLOCCOST;
- X ntn[country].location=GREAT;
- X }
- X else printf("You dont have enough points left");
- X }
- X else {
- X if(points>=2*NLLOCCOST) {
- X points -= 2*NLLOCCOST;
- X ntn[country].location=GREAT;
- X }
- X else printf("You dont have enough points left");
- X }
- X break;
- X case 'f':
- X case FAIR:
- X if(ntn[country].location==RANDOM){
- X if(points>=NLLOCCOST) {
- X points -=NLLOCCOST;
- X ntn[country].location=FAIR;
- X }
- X else printf("You dont have enough points left");
- X }
- X else printf("\nlocation unchanged\n");
- X break;
- X default:
- X printf("\nlocation unchanged\n");
- X }
- X putchar('\n');
- X break;
- X case 4:
- X printf("you start with %ld soldiers\n",ntn[country].tmil);
- X printf("additional military costs 1 / %d\n",NLSOLD);
- X printf("how many points to spend?");
- X scanf("%d",&temp);
- X putchar('\n');
- X if(points >= temp) {
- X points -= temp;
- X ntn[country].tmil+=temp*NLSOLD;
- X }
- X else printf("You dont have enough points left");
- X break;
- X case 5:
- X if(magic(country,VAMPIRE)==1) {
- X printf("you have vampire power and cant add to combat bonus\n");
- X break;
- X }
- X printf("now have %d percent attack bonus\n",ntn[country].aplus);
- X printf("an additional %d percent per point\n",NLATTACK);
- X printf("how many points do you wish to spend?");
- X scanf("%d",&temp);
- X putchar('\n');
- X if(points >= temp) {
- X points -= temp;
- X ntn[country].aplus+=temp*NLATTACK;
- X }
- X else printf("You dont have enough points left");
- X break;
- X case 6:
- X if(magic(country,VAMPIRE)==1) {
- X printf("you have vampire power and cant add to combat bonus\n");
- X break;
- X }
- X printf("now have %d percent defence bonus\n",ntn[country].dplus);
- X printf("an additional %d percent per point\n",NLDEFENCE);
- X printf("how many points do you wish to spend?");
- X scanf("%d",&temp);
- X putchar('\n');
- X if(points >= temp) {
- X points -= temp;
- X ntn[country].dplus+=temp*NLDEFENCE;
- X }
- X else printf("You dont have enough points left");
- X break;
- X case 7:
- X printf("repro rate costs %d points per %d percent\n",NLREPCOST,NLREPRO);
- X printf("you now have %d percent\n",ntn[country].repro);
- X if((ntn[country].race!=ORC)
- X &&(ntn[country].repro>=10)){
- X printf("you have the maximum rate");
- X break;
- X }
- X else if(ntn[country].repro>=15){
- X printf("you have the maximum rate");
- X break;
- X }
- X printf("how many percentage points to add?:");
- X scanf("%d",&temp);
- X putchar('\n');
- X if(points >= (temp*NLREPCOST)) {
- X if((ntn[country].race!=ORC)
- X &&(ntn[country].repro+NLREPRO*temp>10)){
- X printf("that exceeds the 10%% limit");
- X }
- X else if((ntn[country].race==ORC)
- X &&(ntn[country].repro>15)){
- X printf("that exceeds the 15%% limit");
- X }
- X else {
- X points -= temp*NLREPCOST;
- X ntn[country].repro+=NLREPRO*temp;
- X }
- X }
- X else printf("You dont have enough points left");
- X break;
- X case 8:
- X printf("additional movement costs 1 per +%d sct/turn\n",NLMOVE);
- X printf("you start with a rate of %d\n",ntn[country].maxmove);
- X printf("you now have a rate of %d\n",ntn[country].maxmove+NLMOVE);
- X putchar('\n');
- X if(points >= 1) {
- X points -= 1;
- X ntn[country].maxmove+=NLMOVE;
- X }
- X else printf("You dont have enough points left");
- X break;
- X case 9:
- X printf("doubling raw materials\n");
- X if((ntn[country].tfood<800000)
- X &&(points >=NLDBLCOST*ntn[country].tfood/NLHFOOD)) {
- X points-=NLDBLCOST*ntn[country].tfood/NLHFOOD;
- X ntn[country].tfood*=2;
- X ntn[country].jewels*=2;
- X ntn[country].tiron*=2;
- X }
- X else printf("sorry\n");
- X break;
- X case 10:
- X printf("choosing basic magic at %d point cost\n",NLMAGIC);
- X printf("log in and read the magic screen to be informed of your powers\n");
- X if(points >0) {
- X points-=NLMAGIC;
- X loop=0;
- X while(loop==0) if((x=getmagic(rand()%M_MGK+M_MIL))!=0){
- X CHGMGK;
- X loop=1;
- X }
- X }
- X else printf("sorry not enough points\n");
- X break;
- X default:
- X printf("invalid option - hit return");
- X scanf("%*s");
- X }
- X }
- X
- X ntn[country].powers=0;;
- X printnat();
- X printf("\nhit 'y' if OK?");
- X getchar();
- X if(getchar()!='y'){
- X ntn[country].active=0;
- X getchar();
- X printf("\n OK, nation deleted\n");
- X printf("\nhit return to add another nation");
- X printf("\nhit any other key to continue?");
- X if(getchar()=='\n') more=TRUE;
- X else more=FALSE;
- X putchar('\n');
- X }
- X else {
- X place();
- X getchar();
- X printf("\nNation is now added to world");
- X printf("\nhit return to add another nation");
- X printf("\nhit any other key to continue?");
- X if(getchar()=='\n') more=TRUE;
- X else more=FALSE;
- X putchar('\n');
- X }
- X fclose(fexe);
- X }
- X writedata();
- X}
- X
- Xvoid
- Xprintnat()
- X{
- X int i;
- X i=country;
- X printf("about to print stats for nation %d\n\n",i);
- X printf("name is .........%s\n",ntn[i].name);
- X printf("leader is .......%s\n",ntn[i].leader);
- X printf("total sctrs .....%d\n",ntn[i].tsctrs);
- X printf("class is ........%s\n",*(Class+ntn[i].class));
- X printf("mark is .........%c\n",ntn[i].mark);
- X printf("race is .........%c\n",ntn[i].race);
- X printf("attack plus is ..+%d\n",ntn[i].aplus);
- X printf("defence plus is .+%d\n",ntn[i].dplus);
- X printf("gold is .........%ld\n",ntn[i].tgold);
- X printf("maxmove is ......%d sctrs\n",ntn[i].maxmove);
- X printf("jewels is .......%ld\n",ntn[i].jewels);
- X printf("# military ......%ld\n",ntn[i].tmil);
- X printf("# civilians .....%ld\n",ntn[i].tciv);
- X printf("repro is ........%d percent\n",ntn[i].repro);
- X printf("total iron ......%ld\n",ntn[i].tiron);
- X printf("total food ......%ld\n",ntn[i].tfood);
- X printf("total ships .....%d\n",ntn[i].tships);
- X}
- X
- X/*PLACE NATION*/
- Xvoid
- Xplace()
- X{
- X int placed=0;
- X int t;
- X int temp;
- X int n; /*count vbl for inf loop*/
- X short armynum=0;
- X register i,j,x,y;
- X
- X n=0;
- X switch(ntn[country].location) {
- X case OOPS:
- X while ((placed == 0)&&(n++<2000)){
- X if(ntn[country].active==1){
- X x = (rand()%(MAPX-8))+4;
- X y = (rand()%(MAPY-8))+4;
- X }
- X else {
- X x = (rand()%(MAPX-2))+1;
- X y = (rand()%(MAPY-2))+1;
- X }
- X if(is_habitable(x,y)) placed=1;
- X
- X for(i=x-1;i<=x+1;i++) for(j=y-1;j<=y+1;j++)
- X if(sct[i][j].owner!=0) placed=0;
- X temp=0;
- X for(i=x-1;i<=x+1;i++) for(j=y-1;j<=y+1;j++)
- X if(sct[i][j].altitude==WATER) temp++;
- X if(temp>=7) placed=0;
- X if(tofood(sct[x][y].vegetation,country)<DESFOOD) placed=0;
- X }
- X break;
- X case RANDOM:
- X while ((placed == 0)&&(n++<2000)){
- X if(ntn[country].active==1){
- X#if (MAPX>12)
- X x = rand()%(MAPX-12)+6;
- X y = rand()%(MAPY-12)+6;
- X#else
- X x = rand()%(MAPX-8)+4;
- X y = rand()%(MAPY-8)+4;
- X#endif
- X if(is_habitable(x,y)) placed=1;
- X /*important that no countries near*/
- X for(i=x-4;i<=x+4;i++) for(j=y-4;j<=y+4;j++)
- X if((sct[i][j].owner<MAXNTN)
- X &&(sct[i][j].owner!=0)) placed=0;
- X }
- X else {
- X x = (rand()%(MAPX-6))+3;
- X y = (rand()%(MAPY-6))+3;
- X if(is_habitable(x,y)) placed=1;
- X /*important that no countries near*/
- X for(i=x-2;i<=x+2;i++) for(j=y-2;j<=y+2;j++)
- X if((sct[i][j].owner<MAXNTN)
- X &&(sct[i][j].owner!=0)) placed=0;
- X }
- X temp=0;
- X for(i=x-1;i<=x+1;i++) for(j=y-1;j<=y+1;j++)
- X if(sct[i][j].altitude==WATER) temp++;
- X if(temp>=7) placed=0;
- X for(i=x-1;i<=x+1;i++) for(j=y-1;j<=y+1;j++)
- X if(sct[i][j].owner!=0) placed=0;
- X if(tofood(sct[x][y].vegetation,country)<DESFOOD) placed=0;
- X }
- X if (placed==1) for(i=x-1;i<=x+1;i++) for(j=y-1;j<=y+1;j++)
- X if(sct[i][j].altitude!=WATER) sct[i][j].vegetation=GOOD;
- X break;
- X case FAIR:
- X while ((placed == 0)&&(n++<2000)) {
- X if(ntn[country].active==1){
- X#if (MAPX>24)
- X x = rand()%(MAPX-24)+12;
- X y = rand()%(MAPY-24)+12;
- X#else
- X x = rand()%(MAPX-14)+7;
- X y = rand()%(MAPY-14)+7;
- X#endif
- X }
- X else {
- X x = rand()%(MAPX-10)+5;
- X y = rand()%(MAPY-10)+5;
- X }
- X
- X if(is_habitable(x,y)) placed=1;
- X
- X for(i=x-1;i<=x+1;i++) for(j=y-1;j<=y+1;j++)
- X if(sct[i][j].owner!=0) placed=0;
- X
- X if(tofood(sct[x][y].vegetation,country)>=DESFOOD){
- X#if(PWATER>50)
- X temp=0;
- X for(i=x-1;i<=x+1;i++) for(j=y-1;j<=y+1;j++)
- X if(sct[i][j].altitude==WATER) temp++;
- X if(temp>=7) placed=0;
- X
- X /*important that no countries near*/
- X for(i=x-3;i<=x+3;i++) for(j=y-3;j<=y+3;j++){
- X if((sct[i][j].owner<MAXNTN)
- X &&(sct[i][j].owner!=0)) placed=0;
- X }
- X#else
- X temp=0;
- X for(i=x-1;i<=x+1;i++) for(j=y-1;j<=y+1;j++)
- X if(sct[i][j].altitude==WATER) temp++;
- X if(temp>=5) placed=0;
- X
- X /*important that no countries near*/
- X for(i=x-2;i<=x+2;i++) for(j=y-2;j<=y+2;j++){
- X if((sct[i][j].owner<MAXNTN)
- X &&(sct[i][j].owner!=0)) placed=0;
- X }
- X#endif
- X }
- X else placed=0;
- X }
- X if (placed==1) for(i=x-1;i<=x+1;i++) for(j=y-1;j<=y+1;j++)
- X if(sct[i][j].altitude!=WATER) sct[i][j].vegetation=GOOD;
- X break;
- X case GREAT:
- X placed = 0;
- X while ((placed == 0) && (n++<2000)){
- X if(ntn[country].active==1){
- X#if (MAPX>40)
- X x = rand()%(MAPX-40)+20;
- X y = rand()%(MAPY-40)+20;
- X#else
- X x = rand()%(MAPX-18)+9;
- X y = rand()%(MAPY-18)+9;
- X#endif
- X
- X if(is_habitable(x,y)) placed=1;
- X /*important that no countries near*/
- X for(i=x-4;i<=x+4;i++) for(j=y-4;j<=y+4;j++){
- X if((sct[i][j].owner<MAXNTN)
- X &&(sct[i][j].owner!=0)) placed=0;
- X }
- X }
- X else {
- X#if (MAPX>24)
- X x = rand()%(MAPX-24)+12;
- X y = rand()%(MAPY-24)+12;
- X#else
- X x = rand()%(MAPX-12)+6;
- X y = rand()%(MAPY-12)+6;
- X#endif
- X if(is_habitable(x,y)) placed=1;
- X /*important that no countries near*/
- X for(i=x-2;i<=x+2;i++) for(j=y-2;j<=y+2;j++){
- X if((sct[i][j].owner<MAXNTN)
- X &&(sct[i][j].owner!=0)) placed=0;
- X }
- X }
- X
- X for(i=x-1;i<=x+1;i++) for(j=y-1;j<=y+1;j++)
- X if(sct[i][j].owner!=0) placed=0;
- X
- X if(tofood(sct[x][y].vegetation,country)>=DESFOOD) {
- X temp=0;
- X /*if any water within 2 sectors placed = 0*/
- X for(i=x-2;i<=x+2;i++) for(j=y-2;j<=y+2;j++)
- X if(tofood(sct[x][y].vegetation,country)<=0)
- X temp++;
- X#if(PWATER>50)
- X if(temp>=18) placed=0;
- X#else
- X if(temp>=15) placed=0;
- X#endif
- X
- X if (placed==1) switch(ntn[country].race) {
- X case DWARF:
- X sct[x][y].altitude=MOUNTAIN;
- X for(i=x-1;i<=x+1;i++)
- X for(j=y-1;j<=y+1;j++)
- X if((i!=x)&&(j!=y)
- X &&(sct[i][j].altitude!=WATER)){
- X if (rand()%3==0) {
- X sct[i][j].altitude=MOUNTAIN;
- X sct[i][j].gold=rand()%6;
- X sct[i][j].iron=rand()%6;
- X }
- X else {
- X sct[i][j].altitude=HILL;
- X sct[i][j].iron=rand()%4;
- X sct[i][j].gold=rand()%4;
- X }
- X }
- X break;
- X case ELF:
- X sct[x][y].vegetation = FOREST;
- X for(i=x-1;i<=x+1;i++)
- X for(j=y-1;j<=y+1;j++)
- X if((i!=x)&&(j!=y)
- X &&(sct[i][j].altitude!=WATER)) {
- X if (rand()%3==0)
- X sct[i][j].vegetation=FOREST;
- X else sct[i][j].vegetation=WOOD;
- X
- X if (rand()%2==0)
- X sct[i][j].gold=rand()%8;
- X else sct[i][j].gold=rand()%4;
- X }
- X break;
- X case ORC:
- X sct[x][y].altitude=MOUNTAIN;
- X for(i=x-1;i<=x+1;i++)
- X for(j=y-1;j<=y+1;j++)
- X if((i!=x)&&(j!=y)
- X &&(sct[i][j].altitude!=WATER)) {
- X if (rand()%3==0) {
- X sct[i][j].altitude=MOUNTAIN;
- X }
- X else {
- X sct[i][j].altitude=HILL;
- X }
- X if (rand()%2==0){
- X sct[i][j].iron=rand()%8;
- X sct[i][j].gold=rand()%8;
- X }
- X else {
- X sct[i][j].iron=rand()%4;
- X sct[i][j].gold=rand()%4;
- X }
- X }
- X break;
- X case HUMAN:
- X sct[x][y].altitude = CLEAR;
- X for(i=x-1;i<=x+1;i++)
- X for(j=y-1;j<=y+1;j++)
- X if((i!=x)&&(j!=y)
- X &&(sct[i][j].altitude!=WATER)) {
- X if (rand()%2==0)
- X sct[x][y].altitude = CLEAR;
- X
- X if (rand()%2==0)
- X sct[i][j].vegetation=WOOD;
- X else
- X sct[i][j].vegetation=GOOD;
- X
- X if (rand()%2==0)
- X sct[i][j].gold=rand()%7+1;
- X else
- X sct[i][j].iron=rand()%7+1;
- X }
- X break;
- X }
- X }
- X else placed=0;
- X }
- X }
- X
- X /*done with one try*/
- X if(placed==1) {
- X ntn[country].capx = x;
- X ntn[country].capy = y;
- X sct[x][y].designation=DCAPITOL;
- X sct[x][y].owner=country;
- X sct[x][y].people=ntn[country].tciv;
- X sct[x][y].fortress=5;
- X
- X /* put all military into armies of 100 */
- X armynum=0;
- X temp= (int) ntn[country].tmil;
- X ASOLD= (int) ntn[country].tmil/3;
- X ATYPE=A_INFANTRY;
- X temp-=ASOLD;
- X ASTAT=GARRISON;
- X AMOVE=0;
- X AXLOC=ntn[country].capx;
- X AYLOC=ntn[country].capy;
- X armynum++;
- X while ((armynum < MAXARM-1)&&(temp>0)) {
- X if(temp>100){
- X ASOLD=100;
- X ATYPE=A_INFANTRY;
- X temp-=100;
- X }
- X else {
- X ASOLD=temp;
- X ATYPE=A_INFANTRY;
- X temp=0;
- X }
- X AXLOC=ntn[country].capx;
- X AYLOC=ntn[country].capy;
- X ASTAT=DEFEND;
- X AMOVE=ntn[country].maxmove;
- X armynum++;
- X }
- X if(temp>0) {
- X armynum=0;
- X ASOLD+=temp;
- X ATYPE=A_INFANTRY;
- X }
- X
- X /* give you some terain to start with: pc nations get more*/
- X if ((ntn[country].active>=2)&&(ntn[country].location==GREAT))
- X t=1;
- X else if (ntn[country].active>=2) t=0;
- X else if (ntn[country].location==OOPS) t=0;
- X else if (ntn[country].location==RANDOM) t=0;
- X else if (ntn[country].location==FAIR) t=1;
- X else if (ntn[country].location==GREAT) t=2;
- X else printf("error");
- X
- X for(i=x-t;i<=x+t;i++) for(j=y-t;j<=y+t;j++)
- X if((tofood(sct[i][j].vegetation,country)>=DESFOOD)
- X &&(sct[i][j].owner==0)
- X &&(sct[i][j].people==0)) {
- X sct[i][j].owner=country;
- X sct[i][j].designation=DFARM;
- X }
- X }
- X else {
- X if(ntn[country].location==OOPS) printf("ERROR\n");
- X else if(ntn[country].location==RANDOM) {
- X printf("RANDOM PLACE FAILED, TRYING TO PLACE AGAIN\n");
- X ntn[country].location=OOPS;
- X place();
- X }
- X else if(ntn[country].location==FAIR) {
- X printf("FAIR PLACE FAILED, TRYING AGAIN - adding %d people to nation\n",NLPOP);
- X /*give back one point -> NLPOP people*/
- X ntn[country].tciv+=NLPOP;
- X ntn[country].location=RANDOM;
- X place();
- X }
- X else if(ntn[country].location==GREAT) {
- X printf("GOOD PLACE FAILED, TRYING AGAIN - adding %d people to nation\n",NLPOP);
- X /*give back one point -> NLPOP people*/
- X ntn[country].tciv+=NLPOP;
- X ntn[country].location=FAIR;
- X place();
- X }
- X }
- X}
- X
- X/*get class routine*/
- X/* return the number of points needed */
- Xint
- Xgetclass(race)
- X{
- X short check=FALSE,i;
- X int x;
- X short tmp;
- X while(check==FALSE){
- X printf("what type of nation would you like to be\n");
- X if(race!=ORC){
- X printf("1. king (Humans, Dwarves, and Elves)\n");
- X printf("2. emperor (Humans, Dwarves, and Elves)\n");
- X printf("3. wizard (Humans, Dwarves, and Elves)........Cost = 2 Points\n");
- X printf("\tA wizard will have the magical SUMMON power automatically. \n");
- X }
- X if(race==HUMAN){
- X printf("4. theocracy (Humans Only).......................Cost = 2 Points\n");
- X printf("\tA theocracy will have the magical HEALER power automatically. \n");
- X }
- X if((race==HUMAN)||(race==ORC)){
- X printf("5. pirate (Humans & Orcs Only)................Cost = 1 Point\n");
- X printf("\tPirates will have the magical SAILOR power automatically\n");
- X }
- X if((race==ELF)||(race==DWARF)){
- X printf("6. trader (Elves & Dwarves Only)..............Cost = 2 Points\n");
- X printf("\tTraders have URBAN power automatically\n");
- X }
- X if((race==HUMAN)||(race==ORC)){
- X if(magic(country,WARRIOR)==TRUE)
- X printf("7. warlord (Humans & Orcs Only)................Cost = 2 Point\n");
- X else printf("7. warlord (Humans & Orcs Only)................Cost = 3 Point\n");
- X printf("\tWarlords have magical WARLORD power automatically\n");
- X }
- X if(race==ORC){
- X printf("8. demon (Orcs Only).........................Cost = 2 Points\n");
- X printf("\tA demon will have the magical DESTROYER power automatically\n");
- X printf("9. dragon (Orcs Only).........................Cost = 2 Points\n");
- X printf("\tA dragon will have the magical MAJOR MONSTER power automatically\n");
- X printf("10. shadow (Orcs Only)........................Cost = 1 Point\n");
- X printf("\tA shadow will have the magical VOID power automatically\n");
- X }
- X printf("\tinput:");
- X scanf("%hd",&tmp);
- X if((tmp>=1)&&(tmp<=10)) {
- X if((race==HUMAN)&&((tmp<6)||(tmp==7))) check=TRUE;
- X else if((race==DWARF)&&((tmp<=3)||(tmp==6))) check=TRUE;
- X else if((race==ELF)&&((tmp==6)||(tmp<=3))) check=TRUE;
- X else if((race==ORC)&&((tmp==5)||(tmp>6))) check=TRUE;
- X else printf("bad input \n\n\n");
- X } else {
- X printf("\tinvalid input\n\n\n");
- X getchar();
- X }
- X }
- X ntn[country].class=tmp;
- X switch(tmp){
- X case 3:
- X printf("\nwizards have the magical SUMMON power automatically");
- X ntn[country].powers|=SUMMON;
- X x=SUMMON;
- X CHGMGK;
- X return(2);
- X case 4:
- X printf("\ntheocracies have magical HEALER power automatically. ");
- X ntn[country].powers|=HEALER;
- X x=HEALER;
- X CHGMGK;
- X return(2);
- X case 5:
- X printf("\tPirates have the magical SAILOR power automatically\n");
- X ntn[country].powers|=SAILOR;
- X x=SAILOR;
- X CHGMGK;
- X return(1);
- X case 6:
- X printf("\tTraders have URBAN power automatically\n");
- X ntn[country].powers|=URBAN;
- X x=URBAN;
- X CHGMGK;
- X return(2);
- X case 7:
- X i=0;
- X if(magic(country,WARRIOR)!=TRUE){
- X ntn[country].powers|=WARRIOR;
- X x=WARRIOR;
- X CHGMGK;
- X i++;
- X }
- X if(magic(country,CAPTAIN)!=TRUE){
- X ntn[country].powers|=CAPTAIN;
- X x=CAPTAIN;
- X CHGMGK;
- X i++;
- X }
- X if(magic(country,WARLORD)!=TRUE){
- X ntn[country].powers|=WARLORD;
- X x=WARLORD;
- X CHGMGK;
- X i++;
- X }
- X printf("\tWarlords have WARRIOR/CAPTAIN/WARLORD power automatically\n");
- X return(i);
- X case 8:
- X printf("\ndemons have the magical DESTROYER power automatically");
- X ntn[country].powers|=DESTROYER;
- X x=DESTROYER;
- X CHGMGK;
- X return(2);
- X case 9:
- X printf("\ndragons have the magical MAJOR MONSTER power automatically");
- X ntn[country].powers|=AV_MONST;
- X x=AV_MONST;
- X CHGMGK;
- X ntn[country].powers|=MA_MONST;
- X x=MA_MONST;
- X CHGMGK;
- X return(2);
- X case 10:
- X printf("\nshadows have the magical VOID power automatically");
- X ntn[country].powers|=THE_VOID;
- X x=THE_VOID;
- X CHGMGK;
- X return(1);
- X default:
- X return(0);
- X }
- X}
- END_OF_newlogin.c
- if test 28406 -ne `wc -c <newlogin.c`; then
- echo shar: \"newlogin.c\" unpacked with wrong size!
- fi
- # end of overwriting check
- fi
- echo shar: End of archive 1 \(of 8\).
- cp /dev/null ark1isdone
- MISSING=""
- for I in 1 2 3 4 5 6 7 8 ; do
- if test ! -f ark${I}isdone ; then
- MISSING="${MISSING} ${I}"
- fi
- done
- if test "${MISSING}" = "" ; then
- echo You have unpacked all 8 archives.
- rm -f ark[1-9]isdone
- else
- echo You still need to unpack the following archives:
- echo " " ${MISSING}
- fi
- ## End of shell archive.
- exit 0
-